package com.atguigu.system.service.impl;

import com.atguigu.model.system.SysRoleMenu;
import com.atguigu.system.mapper.SysRoleMenuMapper;
import com.atguigu.system.service.SysRoleMenuService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 角色菜单 服务实现类
 * </p>
 *
 * @author lemon
 * @since 2023-01-23
 */
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService {

    /**
     * 获取这个角色的全部权限
     * @param roleId
     * @return
     */
    @Override
    public List<SysRoleMenu> getMenusByRoleId(Long roleId) {
        LambdaQueryWrapper<SysRoleMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(SysRoleMenu::getRoleId, roleId);
        List<SysRoleMenu> list = list(lambdaQueryWrapper);
        return list;
    }
}
